package com.moss.system.mapper;

import com.moss.common.domain.LoginUser;
import com.moss.common.entity.SysDeptEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface DeptMapper {

    List<SysDeptEntity> findDeptAndUserChildListByParentId(@Param("user") LoginUser loginUser, @Param("parentId") String parentId);

    List<SysDeptEntity> selectList(@Param("d") SysDeptEntity dept);

    Integer findMaxSort(@Param("user") LoginUser loginUser, @Param("dept") SysDeptEntity dept);

    List<SysDeptEntity> getDeptInfoByIds(@Param("user") LoginUser loginUser, @Param("list") List<String> deptIdList);

    List<SysDeptEntity> findWithDeptNameUq(@Param("user") LoginUser loginUser, @Param("dept") SysDeptEntity dept);

    SysDeptEntity selectById(Long deptId);

    void insert(@Param("d") SysDeptEntity dept);

    void updateTreeLeaf(@Param("user") LoginUser loginUser, @Param("dept") SysDeptEntity parentDTO);

    int selectNormalChildByParentIds(@Param("user") LoginUser loginUser,@Param("parentIds") String parentIds);

    List<SysDeptEntity> searchChildrenTypeByParentId(@Param("user") LoginUser loginUser, @Param("dept") SysDeptEntity checkSysDept);

    void updateDeptChildren(@Param("deptList") List<SysDeptEntity> updateChildList);

    int selectCount(@Param("user") LoginUser loginUser,@Param("dept") SysDeptEntity dept);

    SysDeptEntity selectDeptByName(String deptName,Long parentId);

    void updateById(@Param("d") SysDeptEntity dept);

    boolean checkHasChild(@Param("d") SysDeptEntity dept);

    boolean checkHasUser(@Param("d") SysDeptEntity dept);

    void deleteById(@Param("d") SysDeptEntity dept);
}
